﻿using System.ComponentModel.DataAnnotations;
using System.Diagnostics.Contracts;
using TaskManager.Domain.Repositories;

namespace TaskManager.Domain.BusinessObjects
{
    /// <summary>
    /// User
    /// </summary>
    public class User : IEntity<int>
    {
        /// <summary>
        /// User identifier
        /// </summary>
        [Key]
        public int Id { get; set; }
        
        /// <summary>
        /// User name
        /// </summary>
        [MaxLength(50)]
        public string Name { get; set; }

        /// <summary>
        /// Parameterless constructor
        /// </summary>
        public User()
        {
        }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="name">User name</param>
        public User(string name)
        {
            Contract.Requires(!string.IsNullOrEmpty(name));

            Name = name;
        }
    }
}